﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="BetVote.aspx.cs" Inherits="LotteryVote.BetVote" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="JS/jquery-1.5.1.min.js" type="text/javascript"></script>
    <script src="JS/jquery.base64.min.js" type="text/javascript"></script>
    <script src="JS/BetOrder.js" type="text/javascript"></script>
    <script src="JS/comm.js" type="text/javascript"></script>
</head>
<body>
    <form id="form1" runat="server" onsubmit="return FillJson()">
    UserId:<asp:TextBox ID="txt_UserId" runat="server"></asp:TextBox>
    <asp:Label ID="lbl_message" runat="server"></asp:Label>
    <table id='tb'>
        <tr>
            <td>
            </td>
            <td>
            </td>
            <td colspan="4">
                2D
            </td>
            <td colspan="4">
                3D
            </td>
            <td colspan="2">
                4D
            </td>
            <td>
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td>
            </td>
            <td>
                数字
            </td>
            <td>
                头
            </td>
            <td>
                尾
            </td>
            <td>
                头尾
            </td>
            <td>
                包组
            </td>
            <td>
                头
            </td>
            <td>
                尾
            </td>
            <td>
                头尾
            </td>
            <td>
                包组
            </td>
            <td>
                尾
            </td>
            <td>
                包组
            </td>
            <td>
            </td>
            <td>
                总金额
            </td>
        </tr>
        <%for (int i = 0; i < 10; i++)
          { %>
        <tr>
            <td>
                <%=i+1 %>
            </td>
            <td>
                <input isnum="true" type="text" style="width: 40px" rowid='<%=i+1 %>' />
            </td>
            <td>
                <input gameplayway="1" game="2D" way="Head" type="text" style="width: 40px" rowid='<%=i+1 %>' />
                <input gameplayway="1" type="checkbox" rowid='<%=i+1 %>' />
            </td>
            <td>
                <input gameplayway="2" game="2D" way="Last" type="text" style="width: 40px" rowid='<%=i+1 %>' />
                <input gameplayway="2" type="checkbox" rowid='<%=i+1 %>' />
            </td>
            <td>
                <input gameplayway="3" game="2D" way="HeadAndLast" type="text" style="width: 40px"
                    rowid='<%=i+1 %>' />
                <input gameplayway="3" type="checkbox" rowid='<%=i+1 %>' />
            </td>
            <td>
                <input gameplayway="4" game="2D" way="Roll" type="text" style="width: 60px" rowid='<%=i+1 %>' />
                <input gameplayway="4" type="checkbox" rowid='<%=i+1 %>' />
            </td>
            <td>
                <input gameplayway="8" game="3D" way="Head" type="text" style="width: 40px" rowid='<%=i+1 %>' />
                <input gameplayway="8" type="checkbox" rowid='<%=i+1 %>' />
            </td>
            <td>
                <input gameplayway="9" game="3D" way="Last" type="text" style="width: 40px" rowid='<%=i+1 %>' />
                <input gameplayway="9" type="checkbox" rowid='<%=i+1 %>' />
            </td>
            <td>
                <input gameplayway="10" game="3D" way="HeadAndLast" type="text" style="width: 40px"
                    rowid='<%=i+1 %>' />
                <input gameplayway="10" type="checkbox" rowid='<%=i+1 %>' />
            </td>
            <td>
                <input gameplayway="11" game="3D" way="Roll" type="text" style="width: 40px" rowid='<%=i+1 %>' />
                <input gameplayway="11" type="checkbox" rowid='<%=i+1 %>' />
            </td>
            <td>
                <input gameplayway="14" game="4D" way="Last" type="text" style="width: 40px" rowid='<%=i+1 %>' />
                <input gameplayway="14" type="checkbox" rowid='<%=i+1 %>' />
            </td>
            <td>
                <input gameplayway="16" game="4D" way="Roll" type="text" style="width: 40px" rowid='<%=i+1 %>' />
                <input gameplayway="16" type="checkbox" rowid='<%=i+1 %>' />
            </td>
            <td>
                <%foreach (var company in TodayCompany)
                  {%>
                <input name='company<%=company.CompanyId+"_"+i %>' company='<%=company.CompanyId %>'
                    id='company<%=company.CompanyId+"_"+i %>' type="checkbox" rowid='<%=i+1 %>' />
                <label for='company<%=company.CompanyId+"_"+i %>'>
                    <%=company.Abbreviation%></label>
                <%} %>
            </td>
            <td>
                <span id='Amount<%=i+1 %>'></span>
            </td>
        </tr>
        <%} %>
    </table>
    <asp:HiddenField ID="hd_betInfo" runat="server" />
    <asp:Button ID="btn_getJson" runat="server" Text="GetJson" OnClick="btn_getJson_Click" />
    <asp:Button ID="btn_AddBet" runat="server" Text="AddBet" OnClick="btn_AddBet_Click" />
    <a href="javascript:printJson()">GetJson</a> <a href='javascript:calcPer()'>Calc</a><a
        href='javascript:calcAmount()'>CalcAmount</a>
    <script type="text/javascript">
        var printJson = function () {
            var json = getBetOrderJson();
            $("#json").text(json);
            InitCompanyNumLen();
            //alert(CompanyNumLen.length);
            //$("#json").text($.base64.decode(getCookie("CompanyNumLen")));
        }
        var FillJson = function () {
            $("#<%=hd_betInfo.ClientID %>").val(getBetOrderJson());
        }
        var calcPer = function () {
            var num = $("#<%=txt_UserId.ClientID %>").val();
            $("#json").text(countPermutation(num));
        }
        $(document).ready(function () {
            $("#tb input[type='text']").bind("keyup", calcAmount);
            $("#tb input[type='checkbox']").bind("change", calcAmount);
        });
        var calcAmount = function () {
            try {
                CalcBetAmount();
            }
            catch (e) {
                alert(e);
            }
        }
    </script>
    </form>
    <div id="json">
    </div>
</body>
</html>
